package com.roncoo.role.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.roncoo.permission.service.IAdminService;
import com.roncoo.role.entity.Adminrole;
import com.roncoo.role.service.IAdminroleService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yuechuanhao
 * @since 2021-03-23
 */
@RestController
@RequestMapping("/adminrole")
public class AdminroleController {

    @Resource
    private IAdminroleService iAdminroleService;

    /**
     * 分页 模糊 查询
     */
    @PostMapping("findAllPage")
    public IPage findAllPage(Adminrole adminrole, Page page){
        IPage Page1 = iAdminroleService.findAllPage(adminrole,page);
        return iAdminroleService.findAllPage(adminrole,page);
    }

    /**
     * 添加角色 角色名，角色备注
     */
    @GetMapping("add")
    public boolean add(Adminrole adminrole){
        return iAdminroleService.save(adminrole);
    }

    /**
     *  删除 by id
     */
    @GetMapping("delById")
    public boolean delById(Integer id){
        return iAdminroleService.removeById(id);
    }

    /**
     *  修改 角色名，角色备注
     */
    @GetMapping("update")
    public boolean update(Adminrole adminrole){
        return iAdminroleService.updateById(adminrole);
    }

    /**
     * 修改 状态
     */
    @PostMapping("upState")
    public boolean upState(Adminrole adminrole){
        return iAdminroleService.updateById(adminrole);
    }



}

